<?php

require_once 'init.php';

$map = array();

foreach ($pages as $pg)
{
	$map[] = array('level'=>0, 'name' => $pg->name(), 'link'=>$pg->link());
	if ($pg->id() == 'boats')
	{
		$boats = query2arrays("
			SELECT boats.id, boats.name	FROM boats ORDER BY boats.sort_order, boats.name
		");
		foreach ($boats as $boat)
		{
			$map[] = array('level'=>5, 'name' => $boat['name'], 'link'=>'/boat.php?id='.$boat['id']);
		}
	}
	if ($pg->id() == 'routs')
	{
		$routs = query2arrays("
			SELECT id, name FROM routs ORDER BY sort_order, name
		");
		foreach ($routs as $rout)
		{
			$map[] = array('level'=>5, 'name' => $rout['name'], 'link'=>'/rout.php?id='.$rout['id']);
		}	
	}
}

$smarty->assign('map',$map);

$sitemapString = getString('Site map');

$smarty->assign(
	'page', 
	new SitePage(
		false, 
		false, 
		$sitemapString, 
		$sitemapString, 
		false, 
		$sitemapString, 
		$sitemapString, 
		$sitemapString
	)
);

show(
	'map', 
	getString('Site map')
);

?>